Nogweii

Bootstrap garage-hq, the S3 compatible service

This is running on my NAS, rather than in the kubernetes cluster.

Setup

Create a docker compose project with the following contents:

services:
  garage:
    image: dxflrs/garage:v2.1.0
    container_name: garage
    volumes:
      - ./garage.toml:/etc/garage.toml
      - ./meta:/var/lib/garage/meta
      - ./data:/var/lib/garage/data
    restart: unless-stopped
    ports:
      - 3900:3900
      - 3901:3901
      - 3902:3902
      - 3903:3903

and create the directories docker/garage-hq/meta and docker/garage-hq/data.
In the docker/garage-hq folder, upload the following (edited!) configuration file:

metadata_dir = "/var/lib/garage/meta"
data_dir = "/var/lib/garage/data"
db_engine = "sqlite"
metadata_auto_snapshot_interval = "6h"

replication_factor = 1
compression_level = 2

rpc_bind_addr = "[::]:3901"
rpc_public_addr = "127.0.0.1:3901"
rpc_secret = "$(openssl rand -hex 32)"

[s3_api]
s3_region = "apartment"
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage.localhost"

[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.garage.localhost"
index = "index.html"

[admin]
api_bind_addr = "[::]:3903"
admin_token = "$(openssl rand -base64 36)"
metrics_token = "$(openssl rand -hex 32)"

This way there is a running instance of garage via container.

Initialization

Then ssh into the NAS and run the following commands to prep garage:

(This is abbreviated from the official quick start guide.)

sudo docker exec -it garage /garage status
sudo docker exec -it garage /garage layout assign -z apartment -c 1T ${node_id_from_status}
sudo docker exec -it garage /garage layout apply --version 1

Once that is done, you have a garage instance that can be configured with terraform.